{extend name="common@create" /}
{block name="formaa"}
	<form action="/admin" method="POST" class="form form-horizontal" id="form-member-add">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户姓名：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="建议使用真实姓名" id="xingming" name="xingming">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户帐号：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="由小写英语字母、数字-_组成，首字符为字母" id="username" name="username">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>所在单位：</label>
			<div class="formControls col-xs-8 col-sm-9 f-l">
				<span class="select-box f-l" style="width:300px;">
				{php} $school = schlist('校级','区级');{/php}
				<select class="select" id="school" name="school" size="1" required>
					<option value="">--请选择所在单位--</option>
					{volist name="school" id="vo"}
						<option value="{$vo.id}">{$vo.title}</option>
					{/volist}
				</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>分配角色：</label>
			{php}
				$group = db('auth_group')->where('status',true)->field('id,title')->all();
			{/php}
			<div class="formControls col-xs-8 col-sm-9">
					<dt>{foreach $group as $key=>$vo } 
						<label class="ml-10">
							<input type="checkbox" value="{$vo.id}" name="group_id[]" id="group_id{$key}">
							{$vo.title}
						</label>{/foreach}
					</dt>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>性别：</label>
			<div class="formControls col-xs-8 col-sm-9 skin-minimal">
				<div class="radio-box">
					<input name="sex" type="radio" id="sex-1" value="1" required="true">
					<label for="sex-1">男</label>
				</div>
				<div class="radio-box">
					<input type="radio" id="sex-2" value="0" name="sex">
					<label for="sex-2">女</label>
				</div>
				<div class="radio-box">
					<input type="radio" id="sex-3" value="2" name="sex" checked>
					<label for="sex-3">保密</label>
				</div>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">出生日期：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text Wdate" value="" placeholder="" id="shengri" name="shengri" onclick="WdatePicker({isShowClear:false,readOnly:true})">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">手机：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="" id="phone" name="phone">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">备注：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea name="beizhu" cols="" rows="" class="textarea"  placeholder="说点什么...最少输入10个字符，最多80个字符" onKeyUp="$.Huitextarealength(this,100)"></textarea>
				<p class="textarea-numberbar"><em class="textarea-length">0</em>/80</p>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
{/block}
{block name="yanzheng"}
<script type="text/javascript">

	// 匹配用户名
	$.validator.addMethod("zh",function(value,element){
		var tel = /^[\u4e00-\u9fa5]*$/;
		return this.optional(element) || tel.test(value);
	}, "请输入中文");

	// 匹配帐号
	$.validator.addMethod("ustr",function(value,element){
		var tel = /^[a-z][a-z0-9-_]*$/;
		return this.optional(element) || tel.test(value);
	}, "用户名由小写字母和 _ - 组成，首字符为字母");

	// 设置表单验证规则
	var myrules = {
			xingming:{
				required:true,
				zh:true,
				rangelength:[2,6]
			},
			username:{
				required:true,
				ustr:true,
				rangelength:[5,20]
			},
			sex:{
				required:true,
			},
			shengri:{
				dateISO:true
			},
			phone:{
				isMobile:true,
			},
		};

	// 设置表单提交方式
	var mytype = 'POST';
</script>
{/block}